package com.hue.springbootjwt.utils;

import com.hue.springbootjwt.domain.User;
import io.jsonwebtoken.Jwts;

import java.util.HashMap;
import java.util.Map;

/**
 * 操作jwt工具类
 */
public class JwtUtils {
    public static String login(User user) {
        Map<String, Object> header = new HashMap<>();
        header.put("alg", "none");
        header.put("typ", "jwt");
        Map<String, Object> body = new HashMap<>();
        body.put("username", user.getUsername());
        body.put("password", user.getPassword());
        return Jwts.builder().setHeader(header).setClaims(body).compact();
    }
}
